import java.util.Random;
import java.util.Scanner;

public class Test {

    public static void main(String[] args) {

        Random random = new Random();
        int randNum = random.nextInt(100);//[0-100)+1     [0-101)
        System.out.println("生成的随机数字："+randNum);

        Scanner scanner = new Scanner(System.in);
        while (true) {
            System.out.println("请输入你要猜的数字：");
            int num = scanner.nextInt();
            if(num > randNum) {
                System.out.println("猜大了！");
            }else if(num == randNum) {
                System.out.println("猜对了！");
                break;
            }else {
                System.out.println("猜小了！");
            }
        }
    }

    public static void main17(String[] args) {
        Scanner scanner = new Scanner(System.in);

/*        while (scanner.hasNextInt()) {
            int a = scanner.nextInt();
            System.out.println(a);
       }*/

        while (scanner.hasNextLine()) {
            String a = scanner.nextLine();
            System.out.println(a);
        }


    }

    public static void main16(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.println("输入你的年龄：");
        int age = scanner.nextInt();
        System.out.println(age);

        scanner.nextLine();

        System.out.println("请输入你的姓名：");
        String name = scanner.nextLine();//输入一个字符串
        System.out.println(name);

        System.out.println("请输入你的工资：");
        float f = scanner.nextFloat();
        System.out.println(f);

    }

    public static void main15(String[] args) {
        System.out.println("输出且换行");
        System.out.print("输出不换行");
        System.out.printf("%s\n","输出");
    }


    public static void main14(String[] args) {
        int i = 0;
        do {
            System.out.println(i);
            i++;
        }while (i != 0);
    }

    public static void main13(String[] args) {
        int sum = 0;
        for (int k = 1; k <= 6; k++) {

            int ret = 1;
            for (int i = 1; i <= k; i++) {
                ret *= i;
            }
            sum += ret;
        }
        System.out.println(sum);
    }

    public static void main12(String[] args) {
        //System.out.println("fdsafdsafsa");
        for (int i = 0; i < 10; i++) {
            System.out.println(i);
        }
    }

    public static void main11(String[] args) {
        //找到1-100之间   既能被3整除 也能被5整除的 数据
        // 要求使用break或者continue
        int  i = 1;
        while (i <= 100) {
            if(i % 15 != 0) {
                i++;
                continue;
            }
            System.out.println(i);
            i++;
        }
    }

    public static void main10(String[] args) {
        int i = 1;
        while (i <= 10) {
            if(i % 3 == 0) {
                System.out.println(i);
                continue;
            }
            i++;
        }
    }

    public static void main9(String[] args) {
        while (true) {
            System.out.println("我去！！！！");
        }
    }

    public static void main8(String[] args) {
        int i = 1;
        int sum = 0;
        while (i <= 5) {
            int n = 1;
            int ret = 1;
            while (n <= i) {
                ret *= n;
                n++;
            }
            //System.out.println(ret);
            sum += ret;
            i++;
        }
        System.out.println(sum);


    }

    public static void main7(String[] args) {
        int n = 1;
        int ret = 1;
        while (n <= 5) {
            ret *= n;
            n++;
        }
        System.out.println(ret);
    }

    public static void main6(String[] args) {
        int a = 1;
        int sum = 0;
        while (a <= 100) {
            sum += a;
            a++;
        }
        System.out.println(sum);

        //1-100奇数的和
        int sumOdd = 0;
        a = 1;
        while (a <= 100) {
            sumOdd += a;
            a += 2;
        }
        System.out.println(sumOdd);

        //1-100偶数的和
        int sumEve = 0;
        a = 2;
        while (a <= 100) {
            sumEve += a;
            a += 2;
        }
        System.out.println(sumEve);

    }

    public static void main5(String[] args) {
        int a = 1;
        while ( a <= 10) {
            System.out.println(a);
            a++;
        }
    }

    public static void main4(String[] args) {
        //double a = 1.0f;
        //boolean flg = true;
        char ch = 'a';
        String str = "gaoobo";
        switch (str) {
            case "2":
                System.out.println(2);
                break;
            case "1":
                System.out.println(1);
                //break;
            default:
                System.out.println("输入有误！");
                break;
        }
    }

    public static void main3(String[] args) {
        Scanner scanner = new Scanner(System.in);
        //Scanner scanner = new Scanner(System.in);
        int year = scanner.nextInt();

        if(year % 100 == 0) {
            if(year % 400 == 0) {
                System.out.println("世纪闰年");
            }else {
                System.out.println("不是闰年");
            }
        }else {
            if(year % 4 == 0) {
                System.out.println("普通闰年");
            }else {
                System.out.println("不是闰年");
            }
        }
    }

    public static void main2(String[] args) {
        System.out.println("aaaa");
        System.out.println("ccc");
        System.out.println("bbbb");

        int a = 10;
        if(a == 10) {
            System.out.println("a == 10");
            System.out.println("fFAdsa");
            System.out.println("1111");
        }
    }

    public static void main1(String[] args) {
        //boolean flg = true == true ? false ? true : false : true;
        boolean flg2 = true == true ? false ? true : false : true;
        System.out.println(flg2);


//        System.out.println("\\hello\\");
//        System.out.println("\"hello\"");
//        System.out.println("\\\"hello\\\"");
//
//        System.out.println(-1 >>> 1);

        //System.out.println(10 > 20 && 10 / 0 == 0);
        //System.out.println(10 < 20 || 10 / 0 == 0);
        //System.out.println(10 < 20 && 10 / 0 == 0);


        //System.out.println(10 > 20 & 10 / 0 == 0);
        //System.out.println(10 < 20 | 10 / 0 == 0);
    }
}
